package tcp

import (
	"net"
)

//read data from peer and decrypt data, and return data
func ReadPacket(conn net.Conn) (Frame, error) {
	return decodeFrame(conn)
}

//just send data to peer
func WritePacket(conn net.Conn, cmd uint16, encType byte, data []byte) error {
	buf, err := buildFrame(cmd, encType, data)
	if err != nil {
		return err
	}
	_, err = conn.Write(buf)
	return err
}
